format long g
clc
close all
clear all
width=1024;
height=768;
numparams=4;
radsg=0.0;


%[F, K,ps , badpoints,corrs, FFormatted, corrsFormatted,EFormatted,spacePts,width,height ] = generateF(3, 0, 1.2,30,1,5,0.3,3 ,width,height ,0.5,0); % fdiff
%[ F, K,ps , badpoints,corrs, FFormatted, corrsFormatted,EFormatted,spacePts ] = generateFtwoangel( 0,0,1.0,20,1,5,0,0 ,width,height,0,0,radsg);
%[ F, K,ps , badpoints,corrs, FFormatted, corrsFormatted,EFormatted,spacePts,widthm,heightm,FFormattedCLEAN,FCLEAN  ] = generateF( 0,0,1,40,0,5,0.2,2 ,width,height,0);
%[ F,corrs,K,height,width,siftoutdirname ] = generateFImages( 'rathaus',0, 0 );
%[corrs, IMS, P,K, F, E, FFormatted, corrsFormatted,EFormatted,FFormattedGT,statusOutliers,corrsFormattedclean,width,height] = readCorrsOxford('btfull', 0,0,0,0);
[ F,corrs,K,height,width,siftoutdirname ] = generateFImages( 'dante',0, 0 );
AlgNames={'puttestshere3','puttestshere4','selfCalibmultistart','selfCalibUnrobust','geometricSelfCalib','findRobustWeightsperfinal'};
numalgs=size(AlgNames,2);
display(' true K was ' ); 
K{1,1}


for k=1:numalgs
        tStart=tic;
    fh=str2func(AlgNames{k});
    [TKK]=fh(F,width,height,4,corrs);
    
    tElapsed = toc(tStart);
    answerf=[ TKK(1,1) TKK(2,2)];
    loca=[ TKK(1,3) TKK(2,3)];
    tt=tElapsed;
    
    [fe,  foc  ] = calcSelfCalibError(answerf, loca,K,0);
    display(['algorithm ' AlgNames{k} ' had f error: ' num2str(fe) ' and oc error ' num2str(foc) ' and time ' num2str(tt)]);
     TKK
end

